<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0px;
            margin: 0px;
            list-style: none;
            text-decoration: none;
        }
        .tab{
            width: 700px;
            margin: 110px auto;
            border: 1px solid red;
        }
        .tab_list ul::after{
            content: '';
            clear: both;
            display: block;
        }
        .tab_list li{
            padding: 10px;
            float: left;
            border: 1px solid rgba(0, 0, 0, .7);
        }
        .tab_con{
            border: 1px solid black;
        }
        .current{
            background: rosybrown;
        }
        .item{
            display: none;
        }
    </style>
</head>
<body>
    <div class="tab">
        <div class="tab_list">
            <ul>
                <li class="current">商品介绍</li>
                <li>规格与包装</li>
                <li>售后保障</li>
                <li>商品评价（11）</li>
            </ul>
        </div>
        <div tab_con>
            <div class="item" style="display: block;">商品介绍模块</div>
            <div class="item">规格与包装模块</div>
            <div class="item">售后保障模块</div>
            <div class="item">商品评价模块</div>
        </div>
    </div>
    <script>
        var tab_list = document.querySelector('.tab_list');
        var lis = tab_list.querySelectorAll('li');
        var items = document.querySelectorAll('.item');
        for(var i = 0; i < lis.length; i++){
            lis[i].setAttribute('index',[i]);
            
            lis[i].onclick = function(){
                for(var i = 0; i < lis.length; i++){
                    lis[i].className = '';
                }
                this.className = 'current';
                for(var j = 0; j < items.length; j++){
                    items[j].style.display = 'none';
                }
                items[this.getAttribute('index')].style.display = 'block';
            }
        }
    </script>
</body>
</html>